package com.xhl.doeverything.es.config;

import cn.hutool.core.date.DatePattern;
import cn.hutool.json.JSONConfig;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ES配置类
 *
 * @author zp
 * @date 2021/04/09 20:22
 **/
@Data
@Configuration
public class EsConfig {

    /**
     * 学生索引
     */
    @Value("${es.index.student-name}")
    private String studentIndexName;

    /**
     * 用户索引
     */
    @Value("${es.index.user-name}")
    private String userIndexName;

    @Bean
    public String studentIndexName(){
        return studentIndexName;
    }

    @Bean
    public String userIndexName(){
        return userIndexName;
    }

    @Bean
    public JSONConfig jsonConfig() {
        return JSONConfig.create().setDateFormat(DatePattern.NORM_DATETIME_PATTERN);
    }
}

